Page({
  data: {
    touchStartY: 0,
    touchEndY: 0
  },

  onLoad() {
    // 页面加载时的初始化
  },

  touchStart(e) {
    this.setData({
      touchStartY: e.touches[0].clientY
    });
  },

  touchEnd(e) {
    this.setData({
      touchEndY: e.changedTouches[0].clientY
    });
    
    const swipeDistance = this.data.touchStartY - this.data.touchEndY;
    if (swipeDistance > 100) {
      // 向上滑动，跳转到主页
      wx.navigateTo({
        url: '/pages/main/main'
      });
    }
  },

  // 处理3D效果的触摸移动
  touchMove(e) {
    const centerX = wx.getSystemInfoSync().windowWidth / 2;
    const centerY = wx.getSystemInfoSync().windowHeight / 2;
    
    const touchX = e.touches[0].clientX;
    const touchY = e.touches[0].clientY;
    
    const xAxis = (centerX - touchX) / 25;
    const yAxis = (centerY - touchY) / 25;
    
    // 更新场景的3D旋转
    const scene = this.selectComponent('.scene');
    if (scene) {
      scene.setStyle({
        transform: `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`
      });
    }
  },

  onStart() {
    wx.navigateTo({
      url: '/pages/userList/index'
    });
  }
}); 